﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace GameBase.Form.Control
{
    public class MyCheckbox : MyControl
    {
        int frameOffset=3;
        bool isChecked;

        public bool IsChecked
        {
            get { return isChecked; }
            set { isChecked = value; }
        }
        public int FrameOffset
        {
            get { return frameOffset; }
            set { frameOffset = value; }
        }
        public MyCheckbox(Vector2 position,string text)
        {
            sprite = new GameBase.Sprite(@"System/Checkbox",2,3);
            Position = position;
            Text = text;
            Margin = 50;
            textAlign = Align.Left;
            
        }
        public override void SetFrame(int frame)
        {
            if (isChecked)
            {
                frame += frameOffset;
            }
            base.SetFrame(frame);
        }
        public override void MouseReleased(int x, int y)
        {
            base.MouseReleased(x, y);
            isChecked = !isChecked;
        }
    }
}
